#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N=23;
int n,m,mk,ans;
bool vis[N]; 
vector<int>ve[N];
void Dfs(int x,int fa,int z,int w)
{
	if(vis[x])w++;
	if(z==m){mk&=w==1;return;}
	for(int y:ve[x])if(y!=fa)Dfs(y,x,z+1,w);
}
int main()
{
	freopen("life.in","r",stdin);
	//freopen("baoli.out","w",stdout);
	cin>>n>>m;
	for(int i=1,x,y;i<n;i++)cin>>x>>y,ve[x].push_back(y),ve[y].push_back(x);
	for(int S=0;S<(1<<n);S++)
	{
		for(int i=1;i<=n;i++)vis[i]=S>>(i-1)&1;
		mk=1;
		for(int i=1;i<=n;i++)Dfs(i,0,1,0);
		ans+=mk;
		if(mk)for(int i=1;i<=n;i++)cout<<vis[i]<<" \n"[i==n]; 
	}
	cout<<ans;
}
